package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

public class ReflectDemo11 {
    public static void main(String[] args) throws Exception {
        Class c = Class.forName("reflect.Person");
        Method m = c.getDeclaredMethod("say", String.class);
        if(m.isAnnotationPresent(AutoRunMethod.class)){
            AutoRunMethod arm = m.getAnnotation(AutoRunMethod.class);
            int value = arm.value();//获取名为value的参数的值
            System.out.println("value的值为："+value);
        }else {
            System.out.println(m.getName()+"该方法没有被@AutoRunMethod注解");
        }
    }
}
